package cappuccino.couldbook.ui;

import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import cappuccino.couldbook.Constants;
import cappuccino.couldbook.R;
import cappuccino.couldbook.base.BaseActivity;
import cappuccino.couldbook.core.mananger.AccountM;
import cappuccino.couldbook.data.Result;
import cappuccino.couldbook.data.User;
import cappuccino.couldbook.net.NetApi;
import cappuccino.couldbook.net.Network;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2016/9/5.
 */
public class StartActivity extends BaseActivity implements View.OnClickListener{

    String TAG = "StartActivity";

    @Override
    protected void init() {

    }
    Button btLogin;
    Button btRegister;
    Button btAdd;
    Button btQuery;
    Button btGroups;
    @Override
    protected void bindView() {
      /*  setContentView(R.layout.activity_test);
        btLogin = (Button)findViewById(R.id.bt_test_login);
        btRegister = (Button)findViewById(R.id.bt_test_register);
        btAdd = (Button)findViewById(R.id.bt_test_addnumber);
        btQuery = (Button)findViewById(R.id.bt_test_querynumber);
        btGroups = (Button)findViewById(R.id.bt_test_groups);
        btLogin.setOnClickListener(this);
        btRegister.setOnClickListener(this);
        btAdd.setOnClickListener(this);
        btQuery.setOnClickListener(this);
        btGroups.setOnClickListener(this);*/

        AccountM accountM = new AccountM(this);
        int userId = accountM.getAccout();
        if(userId != -1)
        {
            toGroups();
            finish();
        }else {
            toLogin();
            finish();
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_test_login:
                toLogin();
                break;
            case R.id.bt_test_register:
                toRegister();
                break;
            case R.id.bt_test_addnumber:
                toAdd();
                break;
            case R.id.bt_test_querynumber:
                toQuery();
                break;
            case R.id.bt_test_groups:
                toGroups();
                break;
            default:
                break;
        }
    }



}
